#include "ACUAS.h"
#include "ACUASlcd.h"

PROGRAM_INIT

VAR16(x);
VAR16(y);
VAR16(x0);
VAR16(y0);
x0 = 0;
y0 = 0;

ACTIVATE_LCD

ACTIVATE_ADC

PROGRAM_START

	ON_BUTTON(4)
	{
		ADC_CHANNEL(1)
		ADCONVERT_MV(x0)
		x0 = x0/6,6;

		ADC_CHANNEL(2)
		ADCONVERT_MV(y0)
		y0 = y0/6,6;
	}

	ADC_CHANNEL(1)
	ADCONVERT_MV(x)
	x = x/6,6;

	ADC_CHANNEL(2)	
	ADCONVERT_MV(y)
	y = y/6,6;

	x = x -x0;
	y = y -y0;

	LCD_XY(1,1)

	LCD_TEXT("X axis:")
	LCD_NUMBER(x)
	LCD_TEXT(" deg  ")	

	LCD_XY(1,2)
	
	LCD_TEXT("Y axis:")
	LCD_NUMBER(y)
	LCD_TEXT(" deg  ")

PROGRAM_END
